<?php

include 'connect.php';

//	product_types:

//	saddle
//	clothing
//	equipment

$query = "SELECT * FROM saddles WHERE product_type = 'saddle' ORDER BY id LIMIT 3"; //Limit to 3 saddles only
$result = mysql_query($query);
	
while($row = mysql_fetch_array($result))
	 
	 {
		 
		 
	$product_name = $row['product_name'];
	$product_status = $row['product_status'];	
	$product_cost = $row['product_cost']; 
	$product_description = $row['product_description'];
	$product_id = $row['product_id'];
	$product_row_id = $row['id'];
	$product_offer = $row['product_offer'];
	
	echo '<li>';
	echo '<form action="product_details.php?'.$product_name.'_second_hand_horse_saddles" method="post" name="product">';
	echo '<img id="product_imgage_large" src="images/saddles/'.$product_row_id.'_1.jpg" width="500" height="500" />';
	echo '<h4>'.$product_name.'</h4>';
	
	if($product_status == "On-trial") //if saddle is on trial
	{
	echo '<p id="ontrial_banner">On-trial</p>';
	}
	
	if($product_status != "On-trial") //if saddle isnt on trial
	{
		if($product_offer != "") //if saddle has is on offer
		{
			echo '<p id="product_banner">'.$product_offer.'</p>';
		}
		
		if($product_offer == "") //if saddle isnt on offer
		{
			echo '';
		}
	}
	
	echo '<p id="product_price"><i>Only</i> £'.$product_cost.'</p>';
	echo '<p id="product_description">'.$product_description.'</p>';
	echo '<input name="product_row_id" type="hidden" value="'.$product_row_id.'" />';
	echo '<input name="view_product" type="submit" class="product_button" value="More details" />';
	
	if($product_status != "On-trial") {echo '<input name="view_product" type="button" class="product_button" value="Buy" />';}
	
	echo '</form>';
		
			
	echo '<p id="product_price"><i>Product ID: '.$product_id.'</i></p>';
	echo '<li>';
	

	 }
	 
	 echo "</ul>";
	 
	 echo "</div>";
	
?>